package main

import (
	"log"
	// "net/rpc"
	// "github.com/NoahShen/aria2rpc"
	"net"
	"net/rpc/jsonrpc"
)

func main() {

	client, err := net.DialTimeout("tcp", "localhost:6800/jsonrpc", 1000*1000*1000*30) // 30秒超时时间
	// ariac, err := jsonrpc.Dial("tcp", "localhost:6800/jsonrpc")
	checkErr(err)
	defer client.Close()

	ariac := jsonrpc.NewClient(client)
	checkErr(err)
	defer ariac.Close()

	var reply interface{}
	err = ariac.Call("getGlobalOption", "", &reply)
	checkErr(err)
	log.Println(reply)

}

func checkErr(err error) {
	if err != nil {
		panic(err)
	}
}
